<%@ page import="com.sunelec.pojo.Users" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!doctype html>
<html lang="en">
<head>
    <title>修改电站信息</title>
    <meta name="renderer" content="webkit" />
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="viewport"
          content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <link href="${pageContext.request.contextPath}/static/css/font-awesome.css" rel="stylesheet" />
    <link href="${pageContext.request.contextPath}/static/css/bootstrap.min.css" rel="stylesheet" />
    <link href="${pageContext.request.contextPath}/static/css/addStation.css" rel="stylesheet" />
    <link rel="stylesheet" href="http://cache.amap.com/lbs/static/main1119.css"/>
    <link href="${pageContext.request.contextPath}/static/css/cityLayout.css" type="text/css" rel="stylesheet">
    <script src="${pageContext.request.contextPath}/static/js/jquery.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/js/cityselect.js"></script>
    <script src="http://cache.amap.com/lbs/static/es5.min.js"></script>
    <script src="http://webapi.amap.com/maps?v=1.4.5&key=您申请的key值"></script>
    <script type="text/javascript" src="http://cache.amap.com/lbs/static/addToolbar.js"></script>
    <script src="${pageContext.request.contextPath}/static/js/jquery.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/js/bootstrap.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/js/echarts.js"></script>
    <script src="${pageContext.request.contextPath}/static/js/imgFile.js"></script>
    <script src="${pageContext.request.contextPath}/static/js/addStation.js"></script>
</head>

<script>
    $(function(){
        init_city_select($("#sel1, #sel2"));
    });
</script>
<script>
    function addsn() {
        $('#block').append('<div class="addSN" ><input type="text" placeholder="请输入新添加的SN号" ><i class="fa fa-minus-square" title="撤销" onclick="delesn()" ></i></div>')
    }
    function delesn() {
        $('.addSN').remove()
    }
</script>

<body>
<div class="top">
    <div class="top-left">
        <div class="kong"></div>
        <div class="logo">
            <img src="${pageContext.request.contextPath}/static/imgs/logo3.png">
        </div>
    </div>
    <div class="top-right">
        <ul class="list">
            <li><a href="${pageContext.request.contextPath}/powerCenter.action?username=${username}">电站中心</a></li>
            <li><a href="checkCenter.jsp">运维中心</a></li>
            <li><a href="${pageContext.request.contextPath}/InReportCenter">报表中心</a></li>
            <li><a href="${pageContext.request.contextPath}/centralizedControl">展示中心</a></li>
            <% if(session.getAttribute("users")!=null){
                Users users = (Users)session.getAttribute("users");
            %>
            <% if(users.getType()==1){%>
            <li><a href="${pageContext.request.contextPath}/InidManage">账号管理</a></li>
            <% }%>
            <% } %>
            <li><a href="${pageContext.request.contextPath}/checkOut.action" ><span class="fa fa-user"></span></a></li>
        </ul>
    </div>
</div>
<div class="main">
    <div class="center">
        <form id="myform" class="form" action="${pageContext.request.contextPath}/edictPowerInfo.action" method="post" name="form1">
                <div class="left">
                    <div class="leftTop">
                        <div class="confirm">
                            <input type="text" name="addType" value="register" style="display: none">
                            <input type="button" onclick="beforeSubmit()" value="确认电站信息">
                        </div>
                        <div class="kong2" style="color: white">${msg}</div>
                    </div>
                    <div class="leftContent">
                        <div class="box1">
                            <div class="side">
                            <span>
                                电站名称
                            </span>
                            </div>
                            <div class="select">
                                <input type="text" value="${power.powerName}" placeholder="输入您要添加的电站名称" id="name" name="powerName">
                            </div>
                        </div>
                        <div class="box2">
                            <div class="side">
                             <span>
                                电站类型
                            </span>
                            </div>
                            <div class="select">
                                <div><input type="radio" name="powerType" id="a" value="家用屋顶"><label for="a">家用屋顶</label></div>
                                <div><input type="radio" name="powerType" id="b" value="商用屋顶"><label for="b">商用屋顶</label></div>
                                <div><input type="radio" name="powerType" id="c" value="工业用屋顶"><label for="c">工业用屋顶</label></div>
                                <div><input type="radio" name="powerType" id="d" value="地面电站"><label for="d">地面电站</label></div>
                            </div>
                        </div>
                        <div class="box4">
                            <div class="side">
                             <span>
                                电站位置
                            </span>
                            </div>
                            <div class="select">
                                <div class="seleTop">
                                    <input name="country" id="sel" type="text" class="country_input" readonly="readonly" placeholder="中国" >
                                    <input name="city" id="sel1"  type="text"  class="city_input" readonly="readonly" value="">
                                    <input name="local" id="sel3" type="text" value="">
                                    <input type="button" class="button btn" value="搜索" id="addMarker"/>
                                    <input type="button" class="button btn" value="取消" id="clearMarker"/>
                                </div>
                                <div class="map">
                                    <div id="container" >

                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="right">
                    <div class="block" id="block">
                        <div class="box">
                            <div class="boxTitle">
                                <span>时区</span>
                            </div>
                            <div class="boxSet shiqu">
                                <input type="text" placeholder="(UTC+08:00)  北京时间" disabled>
                            </div>
                        </div>
                        <div class="box">
                            <div class="boxTitle">
                                方位角（°）
                            </div>
                            <div class="boxSet fangwei">
                                <input type="range" value="180" max="360" min="0" id="fangweiNum">
                                <div id="fangwei"></div>
                            </div>
                        </div>
                        <div class="box">
                            <div class="boxTitle">
                                倾角（°）
                            </div>
                            <div class="boxSet qingjiao">
                                <input type="range"  value="26" max="360" min="0" id="qingjiaoNum">
                                <div id="qingjiao"></div>
                            </div>
                        </div>
                        <div class="box">
                            <div class="boxTitle">
                                币种
                            </div>
                            <div class="boxSet bizhong">
                                <input type="text" placeholder="CNY 人民币" disabled>
                            </div>
                        </div>
                        <div class="box">
                            <div class="boxTitle">
                                平均电价（CNY/kwh）
                            </div>
                            <div class="boxSet dianjia">
                                <input type="number" value="${power.powerAvgElec}" step="0.01" id="price" name="powerAvgElec">
                            </div>
                        </div>
                        <div class="box">
                            <div class="boxTitle">
                                建设成本（CHY）
                            </div>
                            <div class="boxSet chengben">
                                <input type="number" value="${power.powerConCost}" step="10" name="powerConCost" id="cost">
                            </div>
                        </div>
                        <div class="box">
                            <div class="boxTitle">
                                装机容量
                            </div>
                            <div class="boxSet chengben">
                                <input type="number" value="${power.installCapacity}" step="10" id="content" name="capacity">
                            </div>
                        </div>
                        <div class="box">
                            <div class="boxTitle">
                                建设补贴（CHY）
                            </div>
                            <div class="boxSet chengben">
                                <input type="number" value="${power.powerConSubsidy}" step="100" name="powerConSubsidy" id="subsidy">
                            </div>
                        </div>
                        <div class="box">
                            <div class="boxTitle">
                                还款方式
                            </div>
                            <div class="boxSet huankuan">
                                <div><input type="radio" name="repayMethod" id="one" value="等额本金"><label for="one">等额本金</label></div>
                                <div><input type="radio" name="repayMethod" id="two" value="等额本息"><label for="two">等额本息</label></div>
                            </div>
                        </div>
                        <div class="box">
                            <div class="boxTitle">
                                联系电话
                            </div>
                            <div class="boxSet phoneNum">
                                <input type="text" value="${users.phone}" name="phone" id="phone">
                            </div>
                        </div>

                        <div class="box">
                            <div class="boxTitle">
                                SN号
                            </div>
                            <div class="boxSet sn">
                                <input type="text" value="" id="sn" name="sn"><span title="增加SN号" onclick="addsn()"><i class="fa fa-plus-square"></i></span>
                                <input type="text" name="powerSn" value="" id="hide" hidden>
                            </div>
                        </div>

                    </div>
                </div>
        </form>
    </div>
</div>
<script>
    var marker,map = new AMap.Map('container', {
        center: [100.397428, 35.90923],
        layers: [new AMap.TileLayer.Satellite()],
        zoom: 1
    });
    AMap.event.addDomListener(document.getElementById('addMarker'), 'click', function() {
        addMarker();
    }, false);
    function addMarker() {
        marker = new AMap.Marker({
            icon: "http://webapi.amap.com/theme/v1.3/markers/n/mark_b.png",
            position: [120.405467, 39.907761]
        });
        marker.setMap(map);
    }
    AMap.event.addDomListener(document.getElementById('clearMarker'), 'click', function() {
        if (marker) {
            marker.setMap(null);
            marker = null;
        }
    }, false);

    var type='商用屋顶';
    if(type=='家用屋顶'){
        document.getElementById('a').checked=true;
    }
    if(type=='商用屋顶'){
        document.getElementById('b').checked=true;
    }
    if(type=='工业用屋顶'){
        document.getElementById('c').checked=true;
    }
    if(type=='地面电站'){
        document.getElementById('d').checked=true;
    }

    var way='等额本金'
    if(way=='等额本金'){
        document.getElementById('one').checked=true;
    }
    if(way=='等额本息'){
        document.getElementById('two').checked=true;
    }
    var place="${power.powerLocal}";
    var place1=place.trim().split(/\s+/)[0];
    var place2=place.trim().split(/\s+/)[1];
    document.getElementById("sel1").value = place1;
    document.getElementById("sel3").value = place2;

</script>

</body>
</html>
